import React, { Component } from 'react'

export default class Registe extends Component {
  state = {
    username: '',
    password: '',
    repassword: '',
  }
  handle = (name) => (e) => {
    this.setState({
      [name]: e.target.value.trim(),
    })
  }
  render() {
    return (
      <form>
        用户名:
        <input
          type="text"
          value={this.state.username}
          onChange={this.handle('username')}
        />
        <br />
        密码:
        <input
          type="password"
          autoComplete="true"
          value={this.state.password}
          onChange={this.handle('password')}
        />
        <br />
        确认密码:
        <input
          type="password"
          autoComplete="true"
          value={this.state.repassword}
          onChange={this.handle('repassword')}
        />
        <br />
        <button>注册</button>
      </form>
    )
  }
}
